package com.xjrsoft.module.customer.erp_model.erpPurchaseOrderInfo.vo;

import java.math.BigDecimal;
import java.time.LocalDateTime;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Data;
import com.xjrsoft.common.Enum.TransDataType;
import com.xjrsoft.common.annotation.DataTrans;
import io.swagger.annotations.ApiModel;

/**
 * 视图实体类
 *
 * @author pp
 * @since 2021-10-13
 */
@Data
@ApiModel(value = "列表ErpPurchaseorderVo对象", description = "列表ErpPurchaseorderVo对象")
public class ErpPurchaseorderListVo {

    @JsonProperty("F_Id")
    private String fId;

    @JsonProperty("F_PurchaseOrder")
    private String fPurchaseorder;

    @JsonProperty("F_SourceNumber")
    private String fSourcenumber;

    @JsonProperty("F_PurchaseDate")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime fPurchasedate;

    @JsonProperty("F_PurchasePeople")
    private String fPurchasepeople;

    @JsonProperty("F_DeliveryUnit")
    @DataTrans(dataType = TransDataType.DATA_SQL, dataCode = "localDB", sql = "select i.F_Id,F_FullName from erp_inoutunit i where i.F_UniType=1", savedField = "F_Id", showField = "F_FullName", multi = false)
    private String fDeliveryunit;

    @JsonProperty("F_PurchaseType")
    @DataTrans(dataType = TransDataType.DATA_ITEM, dataCode = "采购分类", multi = false)
    private String fPurchasetype;

    @JsonProperty("F_DeliveryDate")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime fDeliverydate;

    @JsonProperty("F_TotalPurchases")
    private BigDecimal fTotalpurchases;

    @JsonProperty("F_PaymentMethod")
    @DataTrans(dataType = TransDataType.DATA_ITEM, dataCode = "Client_PaymentMode", multi = false)
    private String fPaymentmethod;

    @JsonProperty("F_PaymentDate")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime fPaymentdate;

    @JsonProperty("F_Description")
    private String fDescription;

    @JsonProperty("F_CreatorUserId")
    @DataTrans(dataType = TransDataType.USER, multi = false)
    private String fCreatoruserid;

    @JsonProperty("F_CreatorTime")
    @JsonFormat(pattern = "yyyy-MM-dd")
    private LocalDateTime fCreatortime;

    //没有转换之前的值
    @JsonIgnore
    private Integer fAuditmark;

    @JsonProperty("F_AuditMark")
    private String fAuditmarkName;

    public String getfAuditmarkName() {
        String statusName = null;
        if(this.fAuditmark!=null)
        {
            switch (this.fAuditmark) {
                case 1:
                    statusName = "待审核";
                    break;
                case 2:
                    statusName = "审核通过";
                    break;
                default:statusName="待审核";
            }
        }
        return statusName;
    }

    //没有转换之前的值
    @JsonIgnore
    private Integer fInvalidmark;

    //返回的值
    @JsonProperty("F_InvalidMark")
    private String fInvalidmarkName;

    //转换方法
    public String getfInvalidmarkName() {
        String name = null;
        if(this.fInvalidmark!=null){
            switch (this.fInvalidmark) {
                case 1 :
                    name = "正常";
                    break;
                case 2:
                    name = "作废";
                    break;
                default:name="正常";
            }
        }
        return name;
    }

    //没有转换之前的值
    @JsonIgnore
    private Integer fStatus;

    //返回的值
    @JsonProperty("F_Status")
    private String fStatusName;

    //转换方法
    public String getfStatusName() {
        String name = null;
        if(this.fStatus!=null){
            switch (this.fStatus) {
                case 1 :
                    name = "未入库";
                    break;
                case 2:
                    name = "已入库";
                    break;
                case 0:
                    name="部分入库";
                    break;
            }
        }
        return name;
    }


    @JsonProperty("flowStatus")
    private String flowStatus;

    @JsonProperty("nwfSchemeinfoId")
    private String nwfSchemeinfoId;

    @JsonProperty("formId")
    private String formId;
}
